<%@page language="java" contentType="text/html; charset=utf8" pageEncoding="utf8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/documents.css" />"/>
    <script type="text/javascript" src="<c:url value="/resources/scripts/documents.js" />"></script>
</head>
<body>
<form method="POST">
    <ul class="content">
        <c:forEach var="documents" items="${documents}" varStatus="documentsStatus">
            <li>
                <a id="c<c:out value="${documentsStatus.count}"/>" href="#"
                   onclick="javascript: showhide(${documentsStatus.count});return false;">
                    <c:out value="${documents.key}"/>
                </a>
            </li>
            <div id="s<c:out value="${documentsStatus.count}"/>" class="item">
                <input type="checkbox" name="allFiles" value="Select all files"
                       onclick="javascript: selectAll(${documentsStatus.count})"><c:out value="Select all files"/><br/>

                <div style="padding-left: 10px;">
                    <c:forEach var="file" items="${documents.value}" varStatus="fileStatus">
                        <input type="checkbox" name="files" value="${file.path}"><a
                            href="<c:url value="/documents/download?path=${file.path}"/>"><c:out
                            value="${file.name}"/></a><br/>
                    </c:forEach>
                    <input type="submit" formaction="<c:url value="/documents/remove"/>" formmethod="post"
                           value="Remove selected files">
                </div>
            </div>
        </c:forEach>
    </ul>
</form>
<form method="POST">
    <select name="document">
        <c:forEach var="documents" items="${documents}">
            <option name="documentPath" value="${directory},Documents_${documents.key}"><c:out value="${documents.key}"/></option>
        </c:forEach>
    </select>
    <input style="padding-left: 10px" type="submit" formaction="<c:url value="/documents/create"/>"
           formmethod="post" value="Create">
</form>
</body>
</html>